package com.cqupt.sendMes.enums;

import lombok.Getter;

@Getter
public enum HttpStatusEnum {
    SUCCESS(200, "接口调用成功"),
    FAIL(300, "业务处理失败"),
    PARAM_INPUT_INVALID(400, "参数校验非法! "),
    NO_LOGIN(401, "请先登录"),
    LOGIN_EXPIRED(402, "登录信息已失效"),
    LOGIN_FAIL(403, "登录失败"),
    UNKOWN_SYSTEM_ERROR(500, "系统开小差了，请稍后再试"),
    HSF_TIMEOUT(501, "后端接口调用超时"),
    NO_DATA(2000, "未查询到数据"),
    USER_NOT_FOUND(2001, "用户不存在"),
    PASSWORD_ERROR(2002, "密码错误"),
    USER_EXIST(2003, "账号已存在"),
    HTTP_METHOD_ERROR(2004, "不支持的请求访问方式"),
    IO_EXP(2005, "输入/输出操作异常"),
    FILE_UPLOAD_EXP(2006, "文件上传或下载处理失败"),
    SQL_TRANSACTION_ROLLBACK_EXP(2007, "服务器正忙，请稍后再试"),
    INVALID_REQUEST_EXP(2008, "无效参数请求"),
    ILLEGAL_REQUEST_EXP(2009, "非法参数请求"),
    USER_DELETED(2010, "用户已删除"),
    OBJECT_EXIST(2011, "已存在"),
    OBJECT_NOT_EXIST(2012, "不存在"),
    NO_AUTHORITY(2013, "无权限访问"),
    WXP_SUCCESS(1000, "请求成功"),//成功
    WXP_BIZ_FAIL(1001, "业务异常错误"),//业务异常错误
    WXP_UNAUTHORIZED(1002, "未认证"),//未认证
    WXP_SIGN_FAIL(1003, "签名信息错误"),//签名错误
    WXP_NOT_FOUND(1004, "WX接口不存在"),//接口不存在
    WXP_INTERNAL_SERVER_ERROR(1005, "WX服务器开小差了"),//服务器内部错误
    WXP_WEIXIN_ERROR(1006, "和微信交互的过程中发生异常"),//和微信交互的过程中发生异常
    WXP_NETWORK_ERROR(1007, "网络异常"),//网络异常
    WXP_DATA_ERROR(1008, "数据异常"),//数据异常
    WXP_UNKNOWN_ERROR(1009, "未知异常错误");//未知异常


    private int code;
    private String message;

    private HttpStatusEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public static String HttpStatusEnum(int code) {
        HttpStatusEnum[] ae = values();

        for(int i = 0; i < ae.length; ++i) {
            if (ae[i].getCode() == code) {
                return ae[i].getMessage();
            }
        }

        return null;
    }


    public String toString() {
        return "Code: " + this.code + ";Messge: " + this.message;
    }


}
